<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
    <title>首页</title>
</head>
<body style="text-align: center">
<c:choose>
    <c:when test="${sessionScope.user.username eq null}">
        <h1 style="color: aqua">登录页面</h1>
        <form action="/user/signIn" method="post">
            <input type="text" name="username" placeholder="USERNAME"><br>
            <input type="password" name="password" placeholder="PASSWORD"><br>
            <input type="submit" value="登录">
            <a href="/signUp.jsp">注册</a>
        </form>

    </c:when>
    <c:otherwise>
        <h1 style="color: aqua">页面首页</h1>
        <p style="color: blue">用户名称:<a href="/book/queryAllBooks/${sessionScope.user.role}">${sessionScope.user.username}</a></p>
        <h1 style="color: yellow">欢迎使用图书管理系统</h1>

    </c:otherwise>
</c:choose>

<p style="color: green">${sessionScope.message}</p>
<p style="color: red">${sessionScope.error}</p>
</body>
</html>